/** function get(target: object, propertyKey: PropertyKey, receiver?: any): any;*/
/**
 * Gets the property of target, equivalent to `target[propertyKey]` when `receiver === target`.
 * @param target Object that contains the property on itself or in its prototype chain.
 * @param propertyKey The property name.
 * @param receiver The reference to use as the `this` value in the getter function,
 *        if `target[propertyKey]` is an accessor property.
 */

/*const obj = {
  _name: 'ahhh',
  get name(){
    return this._name;
  }
}

const obj2 = {
  _name: 'ahhh2'
}

console.log(Reflect.get(obj, 'name', obj2)); //'ahhh2'*/



//=====================


//如果要个.get的key 不是一个属性访问器, 那么我们这里指定receiver是无效的, 此时并不会改变this指向
/*const obj = {
  _name: 'ahhh',
  name(){
    console.log('this:',this);
    /!*
      this: <ref *1> Object [global] {
        global: [Circular *1],
        clearInterval: [Function: clearInterval],
        clearTimeout: [Function: clearTimeout],
        setInterval: [Function: setInterval],
        setTimeout: [Function: setTimeout] {
          [Symbol(nodejs.util.promisify.custom)]: [Getter]
        },
        queueMicrotask: [Function: queueMicrotask],
        clearImmediate: [Function: clearImmediate],
        setImmediate: [Function: setImmediate] {
          [Symbol(nodejs.util.promisify.custom)]: [Getter]
        }
      }
    *!/
    return this._name;
  }
}

const obj2 = {
  name: 'ahhh2',
  _name: 'ahhh3'
}

console.log(Reflect.get(obj, 'name', obj2)); //[Function: name]
console.log(Reflect.get(obj, 'name', obj2)()); //undefined*/


